from rest_framework.viewsets import ModelViewSet
from meiduo_admin.my_paginate import MyPageNumberPagination
from . import channel_serializers
from goods.models import GoodsChannel, GoodsChannelGroup, GoodsCategory
from rest_framework.generics import ListAPIView


# channel信息
class ChannelViewSet(ModelViewSet):
    pagination_class = MyPageNumberPagination
    serializer_class = channel_serializers.ChannelViewSetSerializer
    queryset = GoodsChannel.objects.all()


# channel type信息
class ChannelTypesView(ListAPIView):
    serializer_class = channel_serializers.ChannelTypesSerializer
    queryset = GoodsChannelGroup.objects.all()


# category信息
class CategoryView(ListAPIView):
    serializer_class = channel_serializers.CategoryViewSetSerializer
    queryset = GoodsCategory.objects.filter(parent=None).all()



















